package ru.budget.mobile.ui.components

import androidx.compose.material3.DatePicker
import androidx.compose.material3.DatePickerColors
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.material3.rememberDatePickerState
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import ru.budget.mobile.ui.theme.black
import ru.budget.mobile.ui.theme.black3
import ru.budget.mobile.ui.theme.black4
import ru.budget.mobile.ui.theme.blue
import ru.budget.mobile.ui.theme.white

@Composable
@Preview(
    showBackground = true,
    device = "id:Xiaomi POCO M5s"
)
private fun calendarPreview() = calendar()

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun calendar(): Long? {
    val state = rememberDatePickerState()

    DatePicker(
        state = state,
        colors = DatePickerColors(
            containerColor = white,
            titleContentColor = black4,
            headlineContentColor = black,
            weekdayContentColor = black3,
            subheadContentColor = black,
            navigationContentColor = black4,
            yearContentColor = black,
            disabledYearContentColor = black,
            currentYearContentColor = black,
            selectedYearContentColor = black,
            disabledSelectedYearContentColor = black,
            selectedYearContainerColor = black,
            disabledSelectedYearContainerColor = black,
            dayContentColor = black3,
            disabledDayContentColor = black3,
            selectedDayContentColor = white,
            disabledSelectedDayContentColor = black,
            selectedDayContainerColor = blue ,
            disabledSelectedDayContainerColor = black,
            todayContentColor = blue,
            todayDateBorderColor = blue,
            dayInSelectionRangeContainerColor = black,
            dayInSelectionRangeContentColor = black,
            dividerColor = Color(0xFFCAC4D0),
            dateTextFieldColors = TextFieldDefaults.colors()
        ),
        showModeToggle = false
    )

    return state.selectedDateMillis
}